<template>
	<view class="main">
		<uv-swipe-action>
			<uv-swipe-action-item :options="options" v-for="(i,o) in messList" :key="o">
				<view class="swipe-action uv-border-top uv-border-bottom">
					<view class="sc" @click="openMinfo(i)">
						<img :src="i.icon" alt="" />
						<view class="sc-badge">
							<uv-badge type="error" max="99" :value="i.num"></uv-badge>
						</view>
						<view class="sct">
							<view class="sctt">
								<view class="scttn">{{i.name}}</view>
								<view class="scttt">{{i.date}}</view>
							</view>
							<view class="sctc">{{i.content}}</view>
						</view>
					</view>
				</view>
			</uv-swipe-action-item>
		</uv-swipe-action>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				options: [{
					text: '删除',
					style: {
						backgroundColor: '#f56c6c'
					}
				}],
				messList: [{
						id: 1,
						name: '王大麻子',
						content: '查询当前用户是否为群成员，防止非群成员发送消息（产生1次云数据库读操作）',
						icon: 'https://www.ysrs.xyz/apiI/ll/file/preview/1743427660814ff80808195d597d90195ec62ec0e0021.png',
						date: '08:21',
						num: 12,
					},
					{
						id: 2,
						name: '王二麻子',
						content: '查询当前用户是否为群成员，防止非群成员发送消息（产生1次云数据库读操作）',
						icon: 'https://www.ysrs.xyz/apiI/ll/file/preview/1743427660814ff80808195d597d90195ec62ec0e0021.png',
						date: '08:20',
						num: 12,
					},
					{
						id: 3,
						name: '王三麻子',
						content: '查询当前用户是否为群成员，防止非群成员发送消息（产生1次云数据库读操作）',
						icon: 'https://www.ysrs.xyz/apiI/ll/file/preview/1743427660814ff80808195d597d90195ec62ec0e0021.png',
						date: '08:20',
						num: 0,
					},
					{
						id: 4,
						name: '王四麻子',
						content: '查询当前用户是否为群成员，防止非群成员发送消息（产生1次云数据库读操作）',
						icon: 'https://www.ysrs.xyz/apiI/ll/file/preview/1743427660814ff80808195d597d90195ec62ec0e0021.png',
						date: '昨天',
						num: 12,
					},
					{
						id: 5,
						name: '王五麻子',
						content: '查询当前用户是否为群成员，防止非群成员发送消息（产生1次云数据库读操作）',
						icon: 'https://www.ysrs.xyz/apiI/ll/file/preview/1743427660814ff80808195d597d90195ec62ec0e0021.png',
						date: '昨天',
						num: 12,
					},
					{
						id: 6,
						name: '王六麻子',
						content: '查询当前用户是否为群成员，防止非群成员发送消息（产生1次云数据库读操作）',
						icon: 'https://www.ysrs.xyz/apiI/ll/file/preview/1743427660814ff80808195d597d90195ec62ec0e0021.png',
						date: '4月12',
						num: 12,
					},
					{
						id: 7,
						name: '王七麻子',
						content: '查询当前用户是否为群成员，防止非群成员发送消息（产生1次云数据库读操作）',
						icon: 'https://www.ysrs.xyz/apiI/ll/file/preview/1743427660814ff80808195d597d90195ec62ec0e0021.png',
						date: '4月12',
						num: 12,
					},
				]
			}
		},
		mounted() {

		},
		methods: {
			openMinfo(item) {
				uni.navigateTo({
					url: '/pages/message/chat?info=' + JSON.stringify(item)
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.main {

		.sc {
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 20rpx 30rpx;
			border-bottom: 1px solid #eee;
			position: relative;

			.sc-badge {
				position: absolute;
				left: 110rpx;
				top: 10rpx;
			}

			img {
				width: 100rpx;
				height: 100rpx;
				border-radius: 12rpx;
				margin-right: 20rpx;
			}

			.sct {
				width: 560rpx;

				.sctt {
					display: flex;
					align-items: center;
					justify-content: space-between;
					margin-bottom: 10rpx;

					.scttn {
						font-size: 33rpx;
						color: #000;
					}

					.scttt {
						font-size: 26rpx;
						color: #999;
					}
				}

				.sctc {
					font-size: 28rpx;
					color: #999;
					width: 540rpx;
					overflow: hidden;
					text-overflow: ellipsis;
					white-space: nowrap;
				}
			}
		}

	}

	.uv-page {
		padding: 0;
	}

	.uv-demo-block__title {
		padding: 10px 0 2px 15px;
	}

	.swipe-action {
		&__content {
			padding: 25rpx 0;

			&__text {
				font-size: 15px;
				color: #222;
				padding-left: 30rpx;
			}
		}
	}
</style>